# 模拟ATM机操作
# 密码 666666

# 定义首页信息
def page():
    '''
    show page
    :return:
    '''
    print("=" * 6, " ATM Gold Vault ", "=" * 6)
    print("\n{:1}{:14}{:10}".format(" ", "1.选择取款", "2.选择存款"))
    print("{:1}{:14}{:10}\n".format(" ", "3.查看余额", "4.退出系统"))
    print("=" * 31)

# 定义存款金额
deposit = 10000

# 定义密码登陆
def yn_passwd():
    '''
    字符串匹配,次数限制
    :return: Ture or False
    '''
    time = 0
    password = "666666"
    while time <3:
        passwd = input("请输入密码：")
        if passwd == password:
            print("{:^24}".format("欢迎使用"))
            return True
        else:
            time += 1
            if time == 3:
                print("密码错误次数超过三次，请重新登陆!")
                #print("来跟着做，头向左倾斜，右手拍右侧头部～ 哎，对，对，看地上有水了不？")

# 定义金额显示格式
def showlist(deposit):
    print("     ～～可怜的存量～～")
    print("{:<4} {:>14}".format("人民币","余额"))
    print("{:^6}:{:>19.2f}".format("¥",deposit))

# 存款
def add_money(deposit):
    """
    输入的金额，累加到存款
    :param deposit:
    :return:
    """
    try:
        money = int(input("干的漂亮！又来存钱了:"))
        if money % 100 != 0:
            print("请输入100的整数倍")
        else:
            deposit += money
            showlist(deposit)
    except Exception :
        print("请规范输入并输入100的整数倍金额")

# 取款
def del_money(deposit):
    """
    存款减去输入的金额 -- 能力有限待完善
    :param deposit:
    :return:
    """
    try:
        money = int(input("请输入孝敬你老婆的金额:"))
        if money % 100 == 0:
            if money > deposit:
                print("自己有多少存款，没点数吗？\n")
                showlist(deposit)
            elif money <= deposit:
                deposit -= money
                showlist(deposit)
            else:
                pass
                # if mes == 0:
                #     showlist(mes)
        else:
            print("输入100整数倍")
    except Exception :
        print("请规范输入并输入100的整数倍金额")

# 主程序 
while True:
    page()
    if yn_passwd():
        key = input("抬起你的汪爪点想要的数字：")
        if key == "1":
            del_money(deposit)
        elif key == "2":
            add_money(deposit)
        elif key == "3":
            showlist(deposit)
        elif key == "4":
            print("客官,欢迎下次再来啊 ")
            break
        else:
            print("来跟着做，头向左倾斜，右手拍右侧头部～ 哎，对，对，看地上有水了不？让你输入指定数字，你输入的是啥呢")
    else:
        break







